# the minimum version of CMake.
cmake_minimum_required(VERSION 3.4.1)
project(mp4parser)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-int-conversion -Wl,-Bsymbolic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wno-int-conversion -Wl,-Bsymbolic")

set(distribution_DIR ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH})

add_library(mp4parser_napi SHARED
           log/ohos_log.cpp
           ffmpeg_thread/ffmpeg_thread.c
           ffmpeg/cmdutils.c
           ffmpeg/ffmpeg.c
           ffmpeg/ffmpeg_filter.c
           ffmpeg/ffmpeg_opt.c
           ffmpeg/custom_ffmpeg_log.c
           ffmpeg/ffmpeg_utils.c
           ffmpeg/ffmpeg_mediametadataretriever.c
           ffmpeg_thread/ffprobe_thread.c
           ffmpeg/ffprobe.c
           napi/mp4parser_napi.cpp
           )

include_directories(
        ${CMAKE_SOURCE_DIR}/include/library/src/main/cpp/include
        ${CMAKE_SOURCE_DIR}/ffmpeg
)

target_link_directories(mp4parser_napi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/third_party/FFmpeg/${OHOS_ARCH}/lib)
											  
target_link_libraries(mp4parser_napi hilog_ndk.z)
target_link_libraries(mp4parser_napi ace_napi.z)
target_link_libraries(mp4parser_napi uv)
target_link_libraries(mp4parser_napi z)
target_link_libraries(mp4parser_napi avcodec)
target_link_libraries(mp4parser_napi avfilter)
target_link_libraries(mp4parser_napi avformat)
target_link_libraries(mp4parser_napi avutil)
target_link_libraries(mp4parser_napi swresample)
target_link_libraries(mp4parser_napi swscale)
target_link_libraries(mp4parser_napi avdevice)